#pragma once


// FindResultDialog dialog

#include "resource.h"
#include "afxwin.h"
#include "afxcmn.h"

class FindResultDialog : public CDialogEx
{
	DECLARE_DYNAMIC(FindResultDialog)

public:
	FindResultDialog(CWnd* pParent = NULL);   // standard constructor
	virtual ~FindResultDialog();

	void set_search_parentwnd( HWND hwnd ){ m_parentwnd = hwnd; }
	void start_search( TCHAR * ptr_str , BOOL is_matchcase , BOOL is_useregex );
	void stop_search();

	void search_thread();

// Dialog Data
	enum { IDD = IDD_SEARCHRESULTDLG };

protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support

	void do_search();

	bool search_line( wchar_t * ptr_line );

	DECLARE_MESSAGE_MAP()

protected:
	HWND m_parentwnd;

	TCHAR m_searchstr[1024];
	bool m_is_matchcase;
	bool m_is_useregex;

	bool m_is_stop;

	HANDLE m_hthread;
public:
	virtual BOOL OnInitDialog();
	CListCtrl m_list;
	afx_msg void OnSize(UINT nType, int cx, int cy);
	CProgressCtrl m_searching_progress;
	afx_msg void OnNMDblclkList(NMHDR *pNMHDR, LRESULT *pResult);
	afx_msg void OnClose();
};
